#!/bin/bash
llvmFile="$1"
outFile=$(echo "$llvmFile" | sed 's/\.ll$//')
if [[ "$outFile" = "$llvmFile" ]]; then
  echo "Input file must be a .ll file"
  exit 1
fi
shift
clang -g -fsanitize=undefined -fPIC -Iruntime -I../CTTK -o "$outFile" "$llvmFile" runtime/io.c runtime/array.c runtime/random.c runtime/bigint.c lib/libcttk.a && ./"$outFile" $@
